﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>文件管理</title>

    <!--common-->
    <link href="/resources/src/css/main.css" rel="stylesheet">
    <link href="/resources/src/css/responsive.css" rel="stylesheet">
    <link href="/resources/src/css/file-list.css" rel="stylesheet">
    <link href="/resources/src/css/paginate.css" rel="stylesheet">
</head>
<body class="sticky-header left-side-collapsed" style="background-color: #f5f8f9;">
    
    <jsp:include page="../common/left-slide.jsp" flush="true">
        <jsp:param name="pageHeader" value="fileHeader" />
    </jsp:include>
    <div class="main-content">
        <jsp:include page="../common/header-start.jsp" />
        <div class="fileList">
            <div class="fileBar">
                <h3>
                    <ul class="clearfix bread">
                    	<c:if test="${type==1 }">
                    		<li class="tap"><a href="javascript:;" onclick="window.history.back();location.reload();">返回上一级</a>&nbsp;|&nbsp;</li>
                    	</c:if>
                        <li class="tap"><a href="/folder/list">文件管理</a></li>
                         <c:if test="${type==1 }">
	                         <li><a href="/folder/childrenFolder/${parentId}">项目文件</a></li>
                         </c:if>
                    </ul>
                </h3>
                <div class="barRight">
                    <div class="barBtn newCreat"><i class="iconfont icon-tianjia"></i> 添加</div>
                    <div class="fileSearch" id="searchFolder"><input type="text" placeholder="输入文件名称查找" id="searchName"><i class="iconfont icon-sousuo-sousuo"></i></div>                    
                </div>
            </div>
            <div class="creatBar">
                <div class="cwrap">
                    <div class="cfileName">
                        <i class="iconfont icon-iconfontwenjian2copy"></i>
                        <input type="text" placeholder="请输入文件名称" id="folderName">
                    </div>
                    <div class="cfileBtn">
                        <span class="cYesBtn">确定</span>
                        <span class="cNoBtn">取消</span>
                        <!-- <i class="iconfont icon-weibiaoti2fuzhi03" icontip='重新命名'></i>
                        <i class="iconfont icon-shanchu2" icontip='删除'></i> -->
                    </div>
                </div>
            </div>
            <div class="fileRow">
                <ul id="mytable">
                	<input type="hidden" id="pageNo" value="${page.pageNo }"/>
					<input type="hidden" id="pageSize" value="${page.pageSize }"/>
					<input type="hidden" id="totalCount" value="${page.totalCount }"/>
					<input type="hidden" id="totalPages" value="${page.totalPages }"/>
					<input type="hidden" id="type" value="${type }"/>
					<input type="hidden" id="parentId" value="${parentId }"/>
                	<c:forEach items="${page.result }" var="folder">
	                    <li>
	                        <div class="rfileName">
	                        <c:if test="${folder.name=='项目文件' }">
		                        <a href="/folder/childrenFolder/${folder.id}"><i class="iconfont icon-iconfontwenjian2copy"></i> <span>${folder.name }</span></a></div>
	                        </c:if>
	                         <c:if test="${folder.name!='项目文件' }">
		                        <a href="/file/detail/${folder.id} "><i class="iconfont icon-iconfontwenjian2copy"></i> <span>${folder.name }</span></a></div>
	                         </c:if>
	                        <c:if test="${folder.name != '我的文件' && folder.name != '项目文件' }">
		                    <c:if test="${type!=1 }">
		                    <div class="rfileBtn">
		                            <i class="iconfont icon-weibiaoti2fuzhi03" icontip='重新命名' data-toggle="modal" data-target="#editFileName" dataid="${folder.id }" dataname="${folder.name }"></i>
		                            <i class="iconfont icon-shanchu2" icontip='删除' data-toggle="modal" data-target="${fn:length(folder.fileList) > 0 ? '#hasFolder' : '#deleteFolder'}" dataid="${folder.id }"></i>
		                    </div>
		                    </c:if>
	                        </c:if>
                            <c:if test="${folder.name == '我的文件' || folder.name == '项目文件' }">
                            <div class="rfileBtn" style="opacity: 0;">
                                <i class="iconfont icon-weibiaoti2fuzhi03"></i>
                                <i class="iconfont icon-shanchu2"></i>
                            </div>
                            </c:if>                           
	                        <div class="rfileTime">创建时间：${folder.createTime }</div>
	                        <div class="rfileNum">共${fn:length(folder.childrenList) >0 ? fn:length(folder.childrenList) : fn:length(folder.fileList)}个文件</div>
	                    </li>
                	</c:forEach>
                </ul>
            </div>
            <!--分页-->
			<!--pagination start-->
			<!-- <div id="pagination"></div> -->
			<jsp:include page="/common/page.jsp" />
			<!--pagination end-->
        </div>
    </div>
    

    
    <!-- 更改文件名称模态框（Modal） -->
    <div class="modal fade" id="editFileName" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header" style="text-align: center;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel">修改文件夹名称</h4>
                </div>
                <div class="modal-body folder_body clearfix">
                	<input type="hidden" id="folderId" value=""/>
                    <label for="editArea" class="folder_label">文件夹名：</label>
                    <input type="text" id="editArea" placeholder="请输入要更换的文件夹名称" />
                </div>
                <div class="modal-footer">
                  <p>
                    <button type="button" class="btn btn-default cancel" data-dismiss="modal">取消</button>
                    <button type="button" id="delFileOK" class="btn btn-primary confirm saveFileName">确认</button>
                  </p>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <!-- 删除模态框（Modal） -->
    <div class="modal fade" id="deleteFolder" tabindex="-1" role="dialog" aria-labelledby="deleteFolderTit" aria-hidden="true">
        <div class="modal-dialog">
        <div class="modal-content text-center">
          <div class="modal-body">
            <p>是否确认删除该文件夹？
          </div>
          <div class="modal-footer">
            <p>
              <button type="button" class="btn btn-default cancel" data-dismiss="modal">取消
              </button>
              <button type="button" id="delFolderOK" class="btn btn-primary confirm">
                确认
              </button>
            </p>
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal -->
    </div>
    <!-- /.modal -->
    <!--清空进度项目模态框-->
    <div class="modal fade" id="hasFolder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content text-center">
                <div class="modal-body">
                    <div class="bg-clear">
                        <img src="/resources/src/images/bg-clearProjects.png" width="262" height="213" />
                        <p>改进度下还存在项目，请清空项目后再操作</p>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary confirm" data-dismiss="modal">确认</button>
                </div>
            </div>
        </div>
    </div>
    <script src="/resources/src/js/jquery-1.9.1.min.js"></script>
    <script src="/resources/src/js/jquery.nicescroll.js"></script>
    <script src="/resources/src/js/bootstrap.min.js"></script>
    <script src="/resources/src/js/main.js"></script>
    <script src="/resources/src/js/jquery.paginate.js"></script>
    <script src="/resources/src/js/folder.js"></script>
    <script src="/resources/src/js/page.js"></script>
</body>
</html>